package com.example.lxc415billiards.service.Impl;

import com.example.lxc415billiards.domain.Banner;
import com.example.lxc415billiards.mapper.BannerMapper;
import com.example.lxc415billiards.service.BannerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BannerServiceImpl implements BannerService {

    @Autowired
    private BannerMapper bannerMapper;

    @Override
    public List<Banner> getAllBanners() {
        return bannerMapper.selectAllBanners();
    }

    @Override
    public Banner getBannerById(int bannerId) {
        return bannerMapper.selectBannerById(bannerId);
    }

    @Override
    public Banner addBanner(Banner banner) {
        bannerMapper.insertBanner(banner);
        return banner;
    }

    @Override
    public void deleteBannerById(int bannerId) {
        bannerMapper.deleteBannerById(bannerId);
    }

    @Override
    public Banner updateBanner(Banner banner) {
        bannerMapper.updateBanner(banner);
        return banner;
    }
}
